package day16;

import java.util.Scanner;

/**
 * 功能描述
 *
 * @author wileda
 * @date 2023/03/23  8:21
 */

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int count = 0;
            for (int i = 1; i <= n; i++) {
                boolean flag = perfectNum(i);
                if (flag) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }

    public static boolean perfectNum(int num) {
        int sum = 0;
        for (int i = 1; i < num; i++){
            if (num % i == 0){
                sum += i;
            }
        }
        return sum == num;
    }
}

